<template>
  <div class="es-footer">
    <!-- 全选按钮 -->
    <div class="form-check">
      <input class="form-check-input" type="checkbox" id="fullCheck" :checked="isfull" @change="checkBoxChange">
      <label class="form-check-label" for="fullCheck">
        全选
      </label>
    </div>

    <!-- 合计 -->
    <div>
      <span>合计：</span>
      <span class="amout">￥{{amount.toFixed(2)}}</span>
    </div>

    <!-- 结算按钮 -->
    <button type="button" class="btn btn-primary btn-settle" :disabled="total==0">结算（{{total}}）</button>

  </div>
</template>

<script>
export default {
  name: 'EsFooter',
  props: {
    //  已勾选商品的总价格
    amount: {
      type: Number,
      default: 0
    },
    // 已勾选商品的总数量
    total: {
      type: Number,
      default: 0
    },
    // 全选按钮的状态
    isfull: {
      type: Boolean,
      default: false
    }
  },
  // 自定义事件
  emits: ['fullchange'],
  methods: {
    checkBoxChange(e) {
      // console.log(e.target.checked);
      this.$emit('fullchange', e.target.checked);
    }
  }
};
</script>

<style scoped>
.es-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  height: 50px;
  width: 100%;
  background-color: #fff;
  border-top: 1px solid #efefef;
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  align-items: center;
}
.amout {
  color: red;
  font-weight: bold;
}
.btn-settle {
  min-width: 90px;
  height: 38px;
  border-radius: 19px;
}
</style>